const EventEmitter = require('events')

class MyEventEmitter extends EventEmitter {}

const event = new MyEventEmitter()

event.on('play', (movie) => {
  console.log(movie)
})

event.once('playonce', (movie) => {
  console.log(movie)
})

event.emit('play', '我和我的祖国')
event.emit('play', '中国机长')

event.emit('playonce', '只执行一次')
event.emit('playonce', '只执行一次')
event.emit('playonce', '只执行一次')